//
//  CustomCollectionViewCell.m
//  UI_19_H
//
//  Created by 男哥逗比 on 16/1/29.
//  Copyright © 2016年 YHY. All rights reserved.
//

#import "CustomCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation CustomCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.titleView = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.titleView];
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.numberOfLines = 2;
        [self.contentView addSubview:self.titleLabel];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.titleView.frame = CGRectMake(5, 5, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 30);
    self.titleLabel.frame = CGRectMake(5, self.contentView.frame.size.height - 20, self.contentView.frame.size.width - 10, 20);
}

- (void)setDetailModel:(DetailModel *)detailModel {
    
    _detailModel = detailModel;
    self.titleLabel.text = _detailModel.title;
    [self.titleView sd_setImageWithURL:[NSURL URLWithString:detailModel.imageModel.large]];
}

@end
